#version 110

uniform vec4 ambientColor;
uniform vec4 diffuseColor;
uniform vec4 specularColor;
uniform float ambientReflection;
uniform float diffuseReflection;
uniform float specularReflection;
uniform float shininess;

varying vec3 normVarying;
varying vec3 lightDirVarying;
varying vec3 viewDirVarying;

void main()
{
    vec3 normal = normalize(normVarying);
    vec3 lightDirection = normalize(lightDirVarying);
    vec3 viewerDirection = normalize(viewDirVarying);

    vec4 ambientIllumination = ambientReflection * ambientColor;
    vec4 diffuseIllumination = diffuseReflection * max(0.0, dot(lightDirection, normal)) * diffuseColor;

    //vec4 specularIllumination = specularReflection * pow(max(0.0, dot(-reflect(lightDirection, normal), viewerDirection)), shininess) * specularColor;
    //fragColor = texture2D(texture, varyingTextureCoordinate) * (ambientIllumination + diffuseIllumination) + specularIllumination;
    //gl_FragColor = vec4(normal, 0);
    //gl_FragColor = (ambientIllumination + diffuseIllumination) + specularIllumination;
    gl_FragColor = (ambientIllumination + diffuseIllumination);

    //gl_FragColor = max(0.0, dot(lightDirection, normal)) * vec4(1,1,1,1);
}

//vec4 specularIllumination = specularReflection * pow(max(0.0,dot(-reflect(lightDirection, ), shininess) * specularColor;
